package com.ricky04.exception;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

/**
 * 错误页面处理
 */
@Component
public class CommErrorPageRegistar implements ErrorPageRegistrar {
    @Override
    public void registerErrorPages(ErrorPageRegistry registry) {
        ErrorPage errorPage404=new ErrorPage(HttpStatus.NOT_FOUND,"/404.html");
        ErrorPage errorPage500=new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,"/500.html");
        ErrorPage args=new ErrorPage(IllegalArgumentException.class,"/args.html");
        registry.addErrorPages(errorPage404,errorPage500,args);
    }
}
